import { makeSourcePlugin } from '@contentlayer/source-contentful'

export default makeSourcePlugin({
  accessToken: process.env['CONTENTFUL_ACCESS_TOKEN']!,
  spaceId: 'rfcpfiludecf',
  environmentId: 'master',
  schemaOverrides: {
    documentTypes: {
      landing: 'Landing',
      blog: { defName: 'Blog', isSingleton: true },
      page: 'Page',
      post: { defName: 'Post', fields: { content: { type: 'markdown' } } },
      person: 'Person',
      config: { defName: 'Config', isSingleton: true },
    },
    nestedTypes: {
      section_faq: 'SectionFaq',
      section_hero: 'SectionHero',
      section_contact: 'SectionContact',
      form_field: 'FormField',
      footer_form: 'FooterForm',
      faq_item: 'FaqItem',
      stackbit_page_meta_extra: 'StackbitPageMetaExtra',
      section_reviews: 'SectionReviews',
      stackbit_page_meta: 'StackbitPageMeta',
      section_pricing: 'SectionPricing',
      section_features: 'SectionFeatures',
      section_cta: 'SectionCta',
      section_content: 'SectionContent',
      section_posts: 'SectionPosts',
      review_item: 'ReviewItem',
      pricing_plan: 'PricingPlan',
      header: 'Header',
      footer: 'Footer',
      footer_nav: 'FooterNav',
      footer_text: 'FooterText',
      feature_item: 'FeatureItem',
      action: 'Action',
    },
  },
})
